/*
 * @Description: 查询表单的DTO
 */
import { ApiProperty } from '@nestjs/swagger';
import { IsOptional, IsString, IsNumber, Min } from 'class-validator';
import { Type } from 'class-transformer';

export class QueryFormTemplateDto {
  @ApiProperty({ description: '页码', required: false, default: 1 })
  @IsOptional()
  @Type(() => Number)
  @IsNumber({}, { message: '页码必须为数字' })
  @Min(1, { message: '页码必须大于0' })
  page?: number = 1;

  @ApiProperty({ description: '每页数量', required: false, default: 10 })
  @IsOptional()
  @Type(() => Number)
  @IsNumber({}, { message: '每页数量必须为数字' })
  @Min(1, { message: '每页数量必须大于0' })
  limit?: number = 10;

  @ApiProperty({ description: '表单名称（模糊搜索）', required: false })
  @IsOptional()
  @IsString({ message: '表单名称必须为字符串' })
  formTemplateId?: string;

  @ApiProperty({ description: '创建者ID', required: false })
  @IsOptional()
  @IsString({ message: '创建者ID必须为字符串' })
  createdBy?: string;

  @ApiProperty({ description: '表单状态', required: false })
  @IsOptional()
  isActive?: boolean;
}

export class QueryFormSubmissionDto {
  @ApiProperty({ description: '页码', required: false, default: 1 })
  @IsOptional()
  @Type(() => Number)
  @IsNumber({}, { message: '页码必须为数字' })
  @Min(1, { message: '页码必须大于0' })
  page?: number = 1;

  @ApiProperty({ description: '每页数量', required: false, default: 10 })
  @IsOptional()
  @Type(() => Number)
  @IsNumber({}, { message: '每页数量必须为数字' })
  @Min(1, { message: '每页数量必须大于0' })
  limit?: number = 10;

  @ApiProperty({ description: '表单模板ID', required: false })
  @IsOptional()
  @IsString({ message: '表单模板ID必须为字符串' })
  formTemplateId?: string;

  @ApiProperty({ description: '提交状态', required: false })
  @IsOptional()
  @IsString({ message: '提交状态必须为字符串' })
  status?: string;

  @ApiProperty({ description: '提交者ID', required: false })
  @IsOptional()
  @IsString({ message: '提交者ID必须为字符串' })
  submitterId?: string;

  @ApiProperty({ description: '开始时间', required: false })
  @IsOptional()
  @IsString({ message: '开始时间必须为字符串' })
  startDate?: string;

  @ApiProperty({ description: '结束时间', required: false })
  @IsOptional()
  @IsString({ message: '结束时间必须为字符串' })
  endDate?: string;
}